﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class employee_employee_login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
        }
        else
        {
            btnLogin.Attributes.Add("OnClick", "javascript:return chk();");
        }
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        Uri url;

        if (this.ViewState["dUrl"] == null)
        {
            url = Request.UrlReferrer;
            this.ViewState["dUrl"] = url;
        }
        else
        {
            url = (Uri)this.ViewState["dUrl"];
        }

        bool isValid = TEmployee.CheckLogin(userid.Text, password.Text, this);
        if (isValid)
        {
            Response.Redirect(url.ToString());
            Response.End();
        }
        else
        {
            msg.Text = "你的用户和密码不符，请再试一次!";
        }
    }
}
